Skip to content

feat(ts): ember-ts client — 65+ methods, full api parity - #309

Merged
kacy merged 3 commits into
mainfrom
feat/ts-proto-gen
Feb 25, 2026
Merged

feat(ts): ember-ts client — 65+ methods, full api parity#309
kacy merged 3 commits into
mainfrom
feat/ts-proto-gen

Conversation

@kacy

@kacy kacy commented Feb 25, 2026

Copy link
Copy Markdown
Owner

summary

the ember-ts package had 160 generated proto type definitions but zero hand-written code. this PR adds the client implementation and ships it as a production-quality npm package.

  • src/types.ts — all exported user-facing interfaces: ClientOptions, SetOptions, GetExOptions, ScanOptions, ZAddOptions, ScoreMember, VSimResult, SlowLogEntry, SubscribeEvent, ScanPage, HScanPage, ZScanPage, SScanPage, TimeResult, VGetResult, VInfoResult, and more
  • src/client.tsEmberClient class with 65+ async methods covering strings, keys, lists, hashes, sets, sorted sets, vectors, pub/sub, server, and slowlog commands. subscribe() returns AsyncIterable<SubscribeEvent> backed by a buffered promise queue so for await works naturally without backpressure issues
  • src/index.ts — clean re-export of the client and all public types
  • README.md — full api table (method, args, returns) for all 65+ methods, quickstart, auth example, scan iteration example, leaderboard example, and type reference
  • package.jsonexports map, engines: { node: ">=18" }, files: ["dist/", "proto/"], @types/node dev dep, keywords
  • Makefile — added build target and proto copy step
  • proto/ember/v1/ember.proto — bundled inside the package so it is self-contained without requiring the repo's proto/ directory at runtime

what was tested

  • npm install && npm run build — zero tsc errors, all 65+ methods compile cleanly
  • confirmed dist/ contains index.js, index.d.ts, client.js, client.d.ts, types.js, types.d.ts
  • confirmed proto/ember/v1/ember.proto is present and loadable via path.join(__dirname, '../proto/...')

design considerations

proto bundling: @grpc/proto-loader requires the .proto file on disk at runtime. rather than referencing ../../proto/ (which breaks once published to npm), the proto is copied into proto/ember/v1/ and loaded via path.join(__dirname, '../proto/ember/v1/ember.proto') — works from both src/ (ts-node) and dist/ (compiled).

streaming: the subscribe() method wraps the gRPC server-streaming call in a buffered async iterable. events that arrive before the caller calls next() are queued; the iterator can be cancelled cleanly by breaking out of for await or calling return().

api shape: follows the Go client conventions (Buffer instead of []byte, no context arg, option objects instead of variadic option functions) adapted to TypeScript idioms.

kacy added 3 commits February 25, 2026 14:19
adds clients/ember-ts/ with Makefile, package.json, and tsconfig.json.
wires the root Makefile proto-ts target to delegate to the new client
Makefile, matching the proto-go and proto-py pattern.

generates 160 TypeScript type definitions from ember.proto via
@grpc/proto-loader's proto-loader-gen-types.
adds the hand-written layer on top of the generated proto stubs:

- src/types.ts: all exported interfaces (ClientOptions, SetOptions,
  ScoreMember, VSimResult, ScanPage, HScanPage, ZScanPage, SScanPage,
  SlowLogEntry, SubscribeEvent, TimeResult, VGetResult, VInfoResult, etc.)

- src/client.ts: EmberClient class with 65+ async methods covering
  strings, keys, lists, hashes, sets, sorted sets, vectors, pub/sub,
  server, and slowlog commands. subscribe() returns an AsyncIterable<SubscribeEvent>
  backed by a buffered promise queue so for-await works cleanly.

- src/index.ts: re-exports EmberClient and all public types

- README.md: full api table, quickstart, auth example, scan/leaderboard
  examples, and type reference

- package.json: exports map, engines (>=18), files list (dist/ + proto/),
  keywords, @types/node devDep

- Makefile: build target + proto copy step

- proto/ember/v1/ember.proto: bundled copy so the package is
  self-contained without requiring the repo's proto/ directory

zero tsc errors, builds cleanly with tsc
@kacy
kacy merged commit 220c079 into main Feb 25, 2026
6 of 7 checks passed
@kacy
kacy deleted the feat/ts-proto-gen branch February 25, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant